import * as ImageUtil from "@/utils/imageUtil.js";
/**
 * hex颜色表
 * 流速器满足/不满足条件颜色(0-255)
 */
export const color = [
  "#ffffff",
  "#030303",
  "#ffffff",
  "#808080",
  "#ff0303",
  "#e60303",
  "#cc3333",
  "#bf6060",
  "#997373",
  "#800303",
  "#731d1d",
  "#663333",
  "#4c0303",
  "#ff342d",
  "#ff7070",
  "#ffa6a6",
  "#ffd9d9",
  "#ff4803",
  "#cc3a03",
  "#b25936",
  "#b28c7d",
  "#661d03",
  "#664133",
  "#ff7640",
  "#ffa480",
  "#ffd1bf",
  "#ff8003",
  "#e67303",
  "#cc853d",
  "#bfa386",
  "#994c03",
  "#806040",
  "#4c2603",
  "#ff9c38",
  "#ffb870",
  "#ffd2a6",
  "#ffecd9",
  "#ffaa03",
  "#e69903",
  "#cc9c3d",
  "#b2a17d",
  "#805503",
  "#665533",
  "#ffbf40",
  "#ffd480",
  "#ffeabf",
  "#ffd403",
  "#e6bf03",
  "#ccb43d",
  "#b2aa7d",
  "#736003",
  "#665d33",
  "#ffdf40",
  "#ffea80",
  "#fff4bf",
  "#ffff03",
  "#e6e603",
  "#cccc3d",
  "#bfbf86",
  "#999903",
  "#808020",
  "#666633",
  "#4c4c03",
  "#ffff38",
  "#ffff70",
  "#ffffa6",
  "#ffffd9",
  "#d4ff03",
  "#bfe603",
  "#b4cc3d",
  "#aab27d",
  "#556603",
  "#464c26",
  "#dfff40",
  "#eaff80",
  "#f4ffbf",
  "#9dff03",
  "#8de603",
  "#95cc3d",
  "#9eb27d",
  "#477303",
  "#526633",
  "#b6ff40",
  "#ceff80",
  "#e7ffbf",
  "#55ff03",
  "#4ce603",
  "#6dcc3d",
  "#8fb27d",
  "#267303",
  "#446633",
  "#80ff40",
  "#aaff80",
  "#d4ffbf",
  "#03ff03",
  "#03e603",
  "#33cc33",
  "#60bf60",
  "#90bf90",
  "#039903",
  "#208020",
  "#336633",
  "#034c03",
  "#38ff38",
  "#70ff70",
  "#a6ffa6",
  "#d9ffd9",
  "#03ff6a",
  "#03e660",
  "#3dcc79",
  "#7db293",
  "#037330",
  "#336648",
  "#30ff67",
  "#80ffb5",
  "#bfffda",
  "#03ffbf",
  "#03e6ac",
  "#3dcca8",
  "#86bfb1",
  "#038c69",
  "#408070",
  "#034c39",
  "#38ffcd",
  "#70ffdb",
  "#a6ffe9",
  "#d9fff5",
  "#03ffff",
  "#03e6e6",
  "#3dcccc",
  "#86bfbf",
  "#039999",
  "#208080",
  "#336666",
  "#034c4c",
  "#38ffff",
  "#70ffff",
  "#a6ffff",
  "#d9ffff",
  "#03d4ff",
  "#03bfe6",
  "#3db4cc",
  "#7daab2",
  "#036073",
  "#335d66",
  "#40dfff",
  "#80eaff",
  "#bff4ff",
  "#03aaff",
  "#0399e6",
  "#3d9ccc",
  "#7da1b2",
  "#034c73",
  "#335566",
  "#40bfff",
  "#80d4ff",
  "#bfeaff",
  "#0380ff",
  "#0366cc",
  "#3d85cc",
  "#86a3bf",
  "#034c99",
  "#406080",
  "#03264c",
  "#389cff",
  "#70b8ff",
  "#a6d2ff",
  "#d9ecff",
  "#034cff",
  "#0345e6",
  "#3d68cc",
  "#7d8db2",
  "#032680",
  "#334266",
  "#4079ff",
  "#80a6ff",
  "#bfd2ff",
  "#0303ff",
  "#0303e6",
  "#3333cc",
  "#6060bf",
  "#737399",
  "#030380",
  "#1d1d73",
  "#333366",
  "#03034c",
  "#3838ff",
  "#7070ff",
  "#a6a6ff",
  "#d9d9ff",
  "#5503ff",
  "#4c03e6",
  "#6d3dcc",
  "#8f7db2",
  "#2a0380",
  "#443366",
  "#8040ff",
  "#aa80ff",
  "#d4bfff",
  "#8c03ff",
  "#7e03e6",
  "#8c3dcc",
  "#a586bf",
  "#540399",
  "#634080",
  "#2a034c",
  "#a538ff",
  "#bf70ff",
  "#d7a6ff",
  "#eed9ff",
  "#c403ff",
  "#b003e6",
  "#ab3dcc",
  "#a67db2",
  "#620380",
  "#5a3366",
  "#d240ff",
  "#e180ff",
  "#f0bfff",
  "#ff03ff",
  "#e603e6",
  "#cc3dcc",
  "#bf86bf",
  "#990399",
  "#802080",
  "#663366",
  "#4c034c",
  "#ff38ff",
  "#ff70ff",
  "#ffa6ff",
  "#ffd9ff",
  "#ff03b2",
  "#e603a1",
  "#cc3da1",
  "#b27da3",
  "#800359",
  "#663357",
  "#ff40c6",
  "#ff80d9",
  "#ffbfec",
  "#ff0366",
  "#e6035c",
  "#cc3d76",
  "#bf869d",
  "#99033d",
  "#804059",
  "#4c031f",
  "#ff3888",
  "#ff70a9",
  "#ffa6c9",
  "#ffd9e8",
  "#333333",
  "#595959",
  "#9e9e9e",
  "#bfbfbf",
  "#e0e0e0",
];
/** hex颜色 映射 颜色表索引 */
export const colorIndexMap = new Map();
color.forEach((hex, i) => {
  colorIndexMap.set(hex, i);
});
/** rgb颜色表 */
export const rgbColor = color.map(ImageUtil.hexToRgb);

/** 灰度颜色表 */
export const grayColor = [
  [1, "#030303", 3], // 颜色索引, 颜色, 灰度
  [251, "#333333", 51],
  [252, "#595959", 89],
  [3, "#808080", 128],
  [253, "#9e9e9e", 158],
  [254, "#bfbfbf", 191],
  [255, "#e0e0e0", 224],
  [0, "#ffffff", 255],
];
/** 灰度 映射 颜色表索引 */
export const grayColorIndexMap = new Map();
/** 灰度颜色表索引列表 */
export const grayColorIndexs = [];
grayColor.forEach((c) => {
  grayColorIndexMap.set(c[2], c[0]);
  grayColorIndexs.push(c[2]);
});
